import '../models/ingredient.dart';

class DataService {
  static final Map<String, List<Ingredient>> categoryData = {
    '调味料': [
      Ingredient(
        name: '生抽',
        category: '调味料',
        description: '由大豆发酵制成的中国传统调味品，具有独特的咸鲜味',
        imageUrl: 'assets/images/soy_sauce.jpg',
        usage: ['炒菜', '凉拌', '蘸料', '腌制'],
        nutrition: {
          '热量': '10kcal/100ml',
          '蛋白质': '1.6g/100ml',
          '脂肪': '0g/100ml',
          '钠': '5.4g/100ml',
        },
      ),
      Ingredient(
        name: '老抽',
        category: '调味料',
        description: '经特殊工艺制成的深色酱油，主要用于上色',
        imageUrl: 'assets/images/dark_soy_sauce.jpg',
        usage: ['炒菜', '红烧', '上色'],
        nutrition: {
          '热量': '12kcal/100ml',
          '蛋白质': '1.8g/100ml',
          '脂肪': '0g/100ml',
          '钠': '6.2g/100ml',
        },
      ),
    ],
    '香辛料': [
      Ingredient(
        name: '八角',
        category: '香辛料',
        description: '八角茴香，具有浓郁的香气，常用于卤味和红烧菜品',
        imageUrl: 'assets/images/star_anise.jpg',
        usage: ['卤味', '红烧', '炖煮'],
        nutrition: {
          '热量': '337kcal/100g',
          '蛋白质': '17.6g/100g',
          '脂肪': '15.9g/100g',
          '碳水化合物': '50.0g/100g',
        },
      ),
      Ingredient(
        name: '花椒',
        category: '香辛料',
        description: '具有独特麻味的调味品，是川菜的重要配料',
        imageUrl: 'assets/images/sichuan_pepper.jpg',
        usage: ['麻辣火锅', '川菜', '炒菜'],
        nutrition: {
          '热量': '288kcal/100g',
          '蛋白质': '13.0g/100g',
          '脂肪': '12.8g/100g',
        },
      ),
    ],
  };

  static List<String> getCategories() {
    return categoryData.keys.toList();
  }

  static List<Ingredient> getIngredientsByCategory(String category) {
    return categoryData[category] ?? [];
  }

  static List<Ingredient> getAllIngredients() {
    List<Ingredient> allIngredients = [];
    categoryData.forEach((category, ingredients) {
      allIngredients.addAll(ingredients);
    });
    return allIngredients;
  }
}